package com.example.mapp;

import com.example.entity.Enclosure;
import org.apache.ibatis.annotations.*;

/**
 * Created by youkun on 2017/9/22.
 */
@Mapper
public interface EnclosureMapp {

    @Select(" select * from enclosure  where id=#{id}")
    Enclosure queryById(String id) throws Exception;

    @Delete(" delete from enclosure where id=#{id}")
    int deleteById(String id)throws Exception;

    @Insert("insert into enclosure (type,url,name,party_id,roles) " +
            "value (#{type},#{url},#{name},#{partyId},#{roles})")
    @SelectKey(statement="select last_insert_id()",keyProperty = "id",keyColumn = "id",before = false,resultType = Long.class)
    int add(Enclosure enclosure)throws Exception;

    @Update(" update enclosure set type=#{type},name=#{name},party_id=#{partyId},roles=#{roles} where id=#{id}")
    int update(Enclosure enclosure)throws Exception;
}
